﻿using HBKY.Shop.Common;
using HBKY.Shop.IService.Customer;
using HBKY.Shop.Model;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace HBKY.Shop.API.Controllers
{
    /// <summary>
    /// 用戶信息
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class CustomerController : ControllerBase
    {
        private readonly ICustomerService _customerService;
        public CustomerController(ICustomerService customerService)
        {
            _customerService = customerService;
        }


        /// <summary>
        /// 用戶信息
        /// </summary>
        [HttpGet("list")]
        public async Task<ResponseMessage<List<CustomerListDto>>> GetCustomerList()
        {
            var result = await _customerService.GetCustomerList();
            return result.Success(MessageModel.Success);
        }

        /// <summary>
        /// 刪除用戶
        /// </summary>
        [HttpDelete("{id}")]
        public async Task<ResponseMessage<bool>> GetCustomerList([FromRoute] long id)
        {
            var result = await _customerService.DeleteCustomerById(id);
            return result.Success(MessageModel.DeleteSuccess);
        }
    }
}
